import QtQuick 1.1
import com.nokia.meego 1.1
import StarMenu 1.0

Item {
    anchors.fill: parent
    x:0; y:0


    StarMenu {
        id: starMenu
        objectName: "Menu3-1"
        anchors.fill: parent
        smooth: true
        radiusH: 230
        radiusV: 100
        delayChangePos: 100
        starCenterVisible: false
        closeDelay: 2000
        openDelay: 2000

//        color: Qt.rgba(0,0,0.8,0.5)
        visualParent: main

        center.x: main.width>>1
        center.y: main.height>>1

        Column {
            id: controls
            visible: starMenu.open
            parent: main
            x: main.width-controls.width
            y: main.height-controls.height
            z: main.z+1

            Row {
                spacing: 15
                Button {
                    property bool hide: false
                    text: "Hide some StarItems"
                    onClicked: if (hide)
                               {
                                   star1.visible = true;
                                   star3.visible = true;
                                   star6.visible = true;
                                   text="Hide StarItems"
                                   hide = false;
                               }
                               else{
                                   star1.visible = false;
                                   star3.visible = false;
                                   star6.visible = false;
                                   text="Unhide StarItems"
                                   hide = true;
                               }
                }
            }
        }



        onStarMenuOpening: {textRect.text =
           "<font size=4>Here two StarItems are delayed separately from the others.<br>"+
           "Three StarItems have a <strong>zoomHoverValue</strong> property set to 2, 3 and 4.<br>"+
           "StarMenu is recalculated when visibility property of StarItems change."+
           "The StarItems of the first sub menu have an <strong>onHoverEvent</strong> "+
           "and <strong>onLeaveEvent</strong> events "+
           "to zoom the StarItems. Also the rotation property is animatetd when a sub menu is rised.</font>";
            textRect.z = starMenu.z;
        }


        StarItem {
            id: star1
            objectName: "STAR1"
            width: 64; height: 64
            zoomHoverValue: 1.5
            Behavior on x  { NumberAnimation { duration: 800; easing.type: Easing.OutBounce } }
            Behavior on y  { NumberAnimation { duration: 800; easing.type: Easing.OutBounce } }
            Behavior on opacity  { NumberAnimation { duration: 800; easing.type: Easing.OutBounce } }
            Behavior on scale  { NumberAnimation { duration: 800; easing.type: Easing.OutQuad } }

            Image {
                anchors.fill: parent; smooth: true
                fillMode: Image.Stretch
                source: "0007.png"
            }
        }

        StarItem {
            id: star2
            objectName: "STAR2"
            width: 64; height: 64
            zoomHoverValue: 2
            Behavior on x  { NumberAnimation { duration: 800; easing.type: Easing.OutBounce } }
            Behavior on y  { NumberAnimation { duration: 800; easing.type: Easing.OutBounce } }
            Behavior on opacity  { NumberAnimation { duration: 800; easing.type: Easing.OutBounce } }
            Behavior on scale  { NumberAnimation { duration: 800; easing.type: Easing.OutQuad } }

            Image {
                anchors.fill: parent; smooth: true
                fillMode: Image.Stretch
                source: "0006.png"
            }
        }
        StarItem {
            id: star3
            objectName: "STAR3"
            width: 64; height: 64
//            delayChangePos:1000
            zoomHoverValue: 2.5
            Behavior on x  { NumberAnimation { duration: 800; easing.type: Easing.OutBounce } }
            Behavior on y  { NumberAnimation { duration: 800; easing.type: Easing.OutBounce } }
            Behavior on opacity  { NumberAnimation { duration: 800; easing.type: Easing.OutBounce } }
            Behavior on scale  { NumberAnimation { duration: 800; easing.type: Easing.OutQuad } }

            Image {
                anchors.fill: parent; smooth: true
                fillMode: Image.Stretch
                source: "0014.png"
            }
        }
        StarItem {
            id: star4
            objectName: "STAR3.5"
            width: 64; height: 64
            zoomHoverValue: 3
            Behavior on x  { NumberAnimation { duration: 800; easing.type: Easing.OutBounce } }
            Behavior on y  { NumberAnimation { duration: 800; easing.type: Easing.OutBounce } }
            Behavior on opacity  { NumberAnimation { duration: 800; easing.type: Easing.OutBounce } }
            Behavior on scale  { NumberAnimation { duration: 800; easing.type: Easing.OutQuad } }

            Image {
                anchors.fill: parent; smooth: true
                fillMode: Image.Stretch
                source: "0010.png"
            }
        }

        StarItem {
            id: star5
            objectName: "STAR4"
            width: 64; height: 64
            Behavior on x  { NumberAnimation { duration: 800; easing.type: Easing.OutBounce } }
            Behavior on y  { NumberAnimation { duration: 800; easing.type: Easing.OutBounce } }
            Behavior on opacity  { NumberAnimation { duration: 800; easing.type: Easing.OutBounce } }

            Image {
                id: image
                anchors.fill: parent; smooth: true
                fillMode: Image.Stretch
                source: "qt.png"
            }

            StarMenu {
                id: starMenu2
                objectName: "Menu3-2"
                anchors.fill: parent; smooth: true
                radiusH: 80
                radiusV: 80
                starCenterVisible: true
//                visualParent: startMenu

                rotation: 0

                onOpenChanged: (open ? rotation = 180 : rotation = 0)
//                onStarMenuOpening: rotation = 720
//                onStarMenuClosing: rotation = 0

                Behavior on rotation  { NumberAnimation { duration: 2000; easing.type: Easing.OutQuad } }

                Behavior on x  { NumberAnimation { duration: 800; easing.type: Easing.OutBounce } }
                Behavior on y  { NumberAnimation { duration: 800; easing.type: Easing.OutBounce } }
                Behavior on opacity  { NumberAnimation { duration: 800; easing.type: Easing.OutBounce } }
                StarItem {
                    width: 64; height: 64
                    zoomHoverValue: 2
                    Behavior on opacity  { NumberAnimation { duration: 800; easing.type: Easing.OutBounce } }
                    Behavior on scale  { NumberAnimation { duration: 800; easing.type: Easing.OutQuad } }

                    Image {
                        anchors.fill: parent; smooth: true
                        fillMode: Image.Stretch
                        source: "0001.png"
                    }
                }
                StarItem {
                    width: 64; height: 64
                    zoomHoverValue: 2
                    Behavior on opacity  { NumberAnimation { duration: 800; easing.type: Easing.OutBounce } }
                    Behavior on scale  { NumberAnimation { duration: 800; easing.type: Easing.OutQuad } }

                    Image {
                        anchors.fill: parent; smooth: true
                        fillMode: Image.Stretch
                        source: "qt.png"
                    }
                    StarMenu {
                        id: starMenu3
                        objectName: "Menu3-3"
                        anchors.fill: parent; smooth: true
                        radiusH: 80
                        radiusV: 80
                        starCenterVisible: true

                        Behavior on x  { NumberAnimation { duration: 800; easing.type: Easing.OutBounce } }
                        Behavior on y  { NumberAnimation { duration: 800; easing.type: Easing.OutBounce } }
                        Behavior on opacity  { NumberAnimation { duration: 800; easing.type: Easing.OutBounce } }

                        StarItem {
                            width: 32; height: 32
                            Behavior on x  { NumberAnimation { duration: 800; easing.type: Easing.OutBounce } }
                            Behavior on y  { NumberAnimation { duration: 800; easing.type: Easing.OutBounce } }
                            Behavior on opacity  { NumberAnimation { duration: 800; easing.type: Easing.OutBounce } }

                            Image {
                                anchors.fill: parent; smooth: true
                                fillMode: Image.Stretch
                                source: "0011.png"
                            }
                        }
                        StarItem {
                            width: 48; height: 48
                            Behavior on x  { NumberAnimation { duration: 800; easing.type: Easing.OutBounce } }
                            Behavior on y  { NumberAnimation { duration: 800; easing.type: Easing.OutBounce } }
                            Behavior on opacity  { NumberAnimation { duration: 800; easing.type: Easing.OutBounce } }

                            Image {
                                anchors.fill: parent; smooth: true
                                fillMode: Image.Stretch
                                source: "0012.png"
                            }
                        }
                        StarItem {
                            width: 32; height: 32
                            Behavior on x  { NumberAnimation { duration: 800; easing.type: Easing.OutBounce } }
                            Behavior on y  { NumberAnimation { duration: 800; easing.type: Easing.OutBounce } }
                            Behavior on opacity  { NumberAnimation { duration: 800; easing.type: Easing.OutBounce } }

                            Image {
                                anchors.fill: parent; smooth: true
                                fillMode: Image.Stretch
                                source: "0007.png"
                            }
                        }
                        StarItem {
                            width: 48; height: 48
                            Behavior on x  { NumberAnimation { duration: 800; easing.type: Easing.OutBounce } }
                            Behavior on y  { NumberAnimation { duration: 800; easing.type: Easing.OutBounce } }
                            Behavior on opacity  { NumberAnimation { duration: 800; easing.type: Easing.OutBounce } }

                            Image {
                                anchors.fill: parent; smooth: true
                                fillMode: Image.Stretch
                                source: "0002.png"
                            }
                        }

                    }

                }
                StarItem {
                    width: 64; height: 64
                    zoomHoverValue: 2
                    Behavior on opacity  { NumberAnimation { duration: 800; easing.type: Easing.OutBounce } }
                    Behavior on scale  { NumberAnimation { duration: 800; easing.type: Easing.OutQuad } }

                    Image {
                        anchors.fill: parent; smooth: true
                        fillMode: Image.Stretch
                        source: "0008.png"
                    }
                }
                StarItem {
                    width: 64; height: 64
                    zoomHoverValue: 2
                    Behavior on opacity  { NumberAnimation { duration: 800; easing.type: Easing.OutBounce } }
                    Behavior on scale  { NumberAnimation { duration: 800; easing.type: Easing.OutQuad } }

                    Image {
                        anchors.fill: parent; smooth: true
                        fillMode: Image.Stretch
                        source: "0009.png"
                    }
                }


                StarItem {
                    width: 64; height: 64
                    zoomHoverValue: 2
                    Behavior on opacity  { NumberAnimation { duration: 800; easing.type: Easing.OutBounce } }
                    Behavior on scale  { NumberAnimation { duration: 800; easing.type: Easing.OutQuad } }

                    Image {
                        anchors.fill: parent; smooth: true
                        fillMode: Image.Stretch
                        source: "0010.png"
                    }

                }

            }
        }


        StarItem {
            id: star6
            width: 64; height: 64
            Behavior on x  { NumberAnimation { duration: 800; easing.type: Easing.OutBounce } }
            Behavior on y  { NumberAnimation { duration: 800; easing.type: Easing.OutBounce } }
            Behavior on opacity  { NumberAnimation { duration: 800; easing.type: Easing.OutBounce } }

            Image {
                anchors.fill: parent; smooth: true
                fillMode: Image.Stretch
                source: "0001.png"
            }
        }

        StarItem {
            id: star7
            width: 64; height: 64
            Behavior on x  { NumberAnimation { duration: 800; easing.type: Easing.OutBounce } }
            Behavior on y  { NumberAnimation { duration: 800; easing.type: Easing.OutBounce } }
            Behavior on opacity  { NumberAnimation { duration: 800; easing.type: Easing.OutBounce } }

            Image {
                anchors.fill: parent; smooth: true
                fillMode: Image.Stretch
                source: "0013.png"
            }
        }
        StarItem {
            id: star8
            width: 64; height: 64
            Behavior on x  { NumberAnimation { duration: 800; easing.type: Easing.OutBounce } }
            Behavior on y  { NumberAnimation { duration: 800; easing.type: Easing.OutBounce } }
            Behavior on opacity  { NumberAnimation { duration: 800; easing.type: Easing.OutBounce } }

            Image {
                anchors.fill: parent; smooth: true
                fillMode: Image.Stretch
                source: "0014.png"
            }
        }


    }

}

